package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Panel;
import com.mall.shopping.dal.entitys.PanelContent;
import com.mall.shopping.dal.entitys.PanelContentItem;
import com.mall.shopping.dto.PanelContentDto;
import com.mall.shopping.dto.PanelContentItemDto;
import com.mall.shopping.dto.PanelDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.lang.annotation.Target;
import java.util.List;

/**
 *  cskaoyan
 */
@Mapper(componentModel = "spring")
public interface ContentConverter {

    @Mappings({})
    PanelContentDto panelContent2Dto(PanelContent panelContent);

    @Mappings({})
    PanelContentDto panelContentItem2Dto(PanelContentItem panelContentItem);

    @Mappings({@Mapping(source = "id",target = "id"),
    @Mapping(source ="name",target = "name"),
    @Mapping(source = "type",target = "type"),
            @Mapping(source = "sortOrder",target = "sortOrder"),
            @Mapping(source = "position",target = "position"),
            @Mapping(source = "limitNum",target = "limitNum"),
            @Mapping(source = "status",target = "status"),
            @Mapping(source = "remark",target = "remark"),
            @Mapping(source = "panelContentItems",target = "panelContentItems")})
    PanelDto panel2Dto(Panel panel);

    List<PanelDto> panels2Dto(List<Panel>panels);

    List<PanelContentDto> panelContents2Dto(List<PanelContent> panelContents);

    List<PanelContentItemDto> panelContentItem2Dto(List<PanelContentItem> panelContentItems);

}
